package site.yunnong.atvris.portal.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import site.yunnong.atvris.common.api.ResultVO;
import site.yunnong.atvris.portal.service.HomeService;
import site.yunnong.atvris.common.dto.PartitionRecommendVideoParam;
import site.yunnong.atvris.common.dto.PartitionVideoRankParam;
import site.yunnong.atvris.service.vo.HeadAdVO;
import site.yunnong.atvris.service.vo.VideoCardVO;
import site.yunnong.atvris.common.dto.HeadRecommendAdParam;
import site.yunnong.atvris.common.dto.HeadRecommendVideoParam;
import site.yunnong.atvris.service.vo.VideoRankVO;

import java.util.List;

/**
 * @author JinghaoZhang
 * @description
 * @create 2021-03-10 16:01
 */
@Slf4j
@RestController
@Api(tags = "首页内容展示")
@RequestMapping(path = "/home")
public class HomeController {

    @Autowired
    private HomeService homeService;

    // todo 还需要改造
    @ApiOperation("首页轮播图推荐")
    @PostMapping("/head-recommend-ad-list")
    public ResultVO headRecommendAdList(@RequestBody HeadRecommendAdParam param) {
        List<HeadAdVO> result =  homeService.headRecommendAdList(param);
        return new ResultVO().success(result);
    }

    // todo 还需要改造
    @ApiOperation("首页头部视频推荐")
    @PostMapping("/head-recommend-video-list")
    public ResultVO headRecommendVideoList(@RequestBody HeadRecommendVideoParam param) {
        List<VideoCardVO> result = homeService.headRecommendVideoList(param);
        return new ResultVO().success(result);
    }

    // todo 还需要改造
    @ApiOperation("首页分区视频推荐")
    @PostMapping("/partition-recommend-video-list")
    public ResultVO partitionRecommendVideoList(@RequestBody PartitionRecommendVideoParam param) {
        List<VideoCardVO> result = homeService.partitionRecommendVideoList(param);
        return new ResultVO().success(result);
    }

    // todo 还需要改造
    @ApiOperation("首页分区视频排行榜")
    @PostMapping("/partition-video-rank-list")
    public ResultVO partitionVideoRankList(@RequestBody PartitionVideoRankParam param) {
        List<VideoRankVO> result = homeService.partitionVideoRankList(param);
        return new ResultVO().success(result);
    }
}
